

const Koa = require('koa');
const app = new Koa();

app.use(async (ctx)=>{
    let postdata = '';
    ctx.req.on('data',(data)=>{
        postdata += data;
    });
    ctx.req.on('end',()=>{
        console.log('postdata:',postdata);
        ctx.response.body = {
            url:ctx.request.url,
            query:ctx.request.query,
            method:ctx.request.method,
            postdata:postdata
        };
    });
});


app.listen(3000,()=>{
    console.log('server is running at http://localhost:3000');
});
